package day11.ThreadTest;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Scanner;

public class Test3 {
    public static void main(String[] args) {
        Thread t1 = new Thread(){
            @Override
            public void run() {
                SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
                while(true){
                    String format = sdf.format(new Date());
                    System.out.println(format);
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                        System.out.println("谁TMD捅醒了老子");
                        //break;
                    }
                }
            }

        };
        t1.start();
        System.out.println("按回车");
        new Scanner(System.in).nextLine();
        t1.interrupt();

    }

}
